package com.zhiyou100.loans.service.impl;

import com.zhiyou100.loans.dao.WithdrawDao;
import com.zhiyou100.loans.dao.impl.WithdrawDaoImpl;
import com.zhiyou100.loans.model.Result;
import com.zhiyou100.loans.model.WithDraw;
import com.zhiyou100.loans.service.WithdrawService;
import com.zhiyou100.loans.util.NetDate;

import net.sf.json.JSONObject;

public class WithdrawServiceImpl implements WithdrawService {
	WithdrawDao wd = new WithdrawDaoImpl();
	@Override
	public JSONObject add(String money, String userid) {
		Result result = new Result(false,"提现记录添加失败");
		WithDraw wdw = new WithDraw();
		wdw.setMoney(Double.parseDouble(money));
		wdw.setUserid(Integer.parseInt(userid));
		wdw.setWithdrawtime(NetDate.getCurrentTime());
		wdw.setWithdrawtype(1);
		int i = wd.add(wdw);
		if(i>0){
			result.setFlag(true);
			result.setMessage("提现记录添加成功");
		}
		return JSONObject.fromObject(result);
	}

}
